home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / vim_src.zip / MACROS.H < prev    next >
Text File  |  1993-01-12  |  1KB  |  45 lines

  1. /* vi:ts=4:sw=4
  2.  *
  3.  * VIM - Vi IMitation
  4.  *
  5.  * Code Contributions By:    Bram Moolenaar            mool@oce.nl
  6.  *                            Tim Thompson            twitch!tjt
  7.  *                            Tony Andrews            onecom!wldrdg!tony 
  8.  *                            G. R. (Fred) Walter        watmath!watcgl!grwalter 
  9.  */
  10.  
  11. /*
  12.  * macros.h: macro definitions for often used code
  13.  */
  14.  
  15. /*
  16.  * pchar(lp, c) - put character 'c' at position 'lp'
  17.  */
  18. #define pchar(lp, c) (*(nr2ptr((lp).lnum) + (lp).col) = (c))
  19.  
  20. /*
  21.  * Position comparisons
  22.  */
  23. #define lt(a, b) (((a).lnum != (b).lnum) \
  24.                    ? ((a).lnum < (b).lnum) : ((a).col < (b).col))
  25.  
  26. #define ltoreq(a, b) (((a).lnum != (b).lnum) \
  27.                    ? ((a).lnum < (b).lnum) : ((a).col <= (b).col))
  28.  
  29. #define equal(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
  30.  
  31. /*
  32.  * buf1line() - return TRUE if there is only one line in file buffer
  33.  */
  34. #define buf1line() (line_count == 1)
  35.  
  36. /*
  37.  * lineempty() - return TRUE if the line is empty
  38.  */
  39. #define lineempty(p) (*nr2ptr(p) == NUL)
  40.  
  41. /*
  42.  * bufempty() - return TRUE if the file buffer is empty
  43.  */
  44. #define bufempty() (buf1line() && lineempty((linenr_t)1))
  45.